﻿using AbpEntityFrameworkcore.DbContext;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AbpEntityFrameworkcore.DbContextDesignFac
{
    public class MyDbContextDesignFac : IDesignTimeDbContextFactory<MyDbContext>
    {

        string Lmsconnstr = Environment.GetEnvironmentVariable("Lmsconnstr", EnvironmentVariableTarget.Machine);
        public MyDbContext CreateDbContext(string[] args)
        {
            DbContextOptionsBuilder<MyDbContext> builder =
            new DbContextOptionsBuilder<MyDbContext>();   
            builder.UseSqlServer(Lmsconnstr);
            MyDbContext ctx = new MyDbContext(builder.Options);
            return ctx;
        }

    
    }
}
